package com.wicket.okrframework.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrframework.biz.service.PostTypeService;
import com.wicket.okrframework.biz.service.dto.req.*;
import com.wicket.okrframework.biz.service.dto.res.*;
import com.wicket.okrframework.common.ro.OkrResult;
import com.wicket.okrframework.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/base/postType/")
public class PostTypeController {

    @Autowired
    PostTypeService postTypeService;

    /**
   * D1-3批量修改岗位类型等级范围
   */
    @PostMapping("batchUpdateGradeScope")
    public OkrResult<BatchUpdateGradeScopeRespDto> batchUpdateGradeScope(@RequestBody @Validated BatchUpdateGradeScopeReqDto reqDTO){
    return OkrResult.success(postTypeService.batchUpdateGradeScope(reqDTO));
    }

    /**
   * D1-3批量删除等级范围
   */
    @PostMapping("batchDeleteGradeScope")
    public OkrResult<BatchDeleteGradeScopeRespDto> batchDeleteGradeScope(@RequestBody @Validated BatchDeleteGradeScopeReqDto reqDTO){
    return OkrResult.success(postTypeService.batchDeleteGradeScope(reqDTO));
    }

    /**
   * D1-3批量查询等级范围列表
   */
    @PostMapping("batchQueryGradeScope")
    public OkrResult<BatchQueryGradeScopeRespDto> batchQueryGradeScope(@RequestBody @Validated BatchQueryGradeScopeReqDto reqDTO){
    return OkrResult.success(postTypeService.batchQueryGradeScope(reqDTO));
    }

    /**
   * D1-3删除职务级别
   */
    @PostMapping("deletePositionGrade")
    public OkrResult<DeletePositionGradeRespDto> deletePositionGrade(@RequestBody @Validated DeletePositionGradeReqDto reqDTO){
    return OkrResult.success(postTypeService.deletePositionGrade(reqDTO));
    }

    /**
   * D1-3修订岗位类型
   */
    @PostMapping("reviseStationType")
    public OkrResult<ReviseStationTypeRespDto> reviseStationType(@RequestBody @Validated ReviseStationTypeReqDto reqDTO){
    return OkrResult.success(postTypeService.reviseStationType(reqDTO));
    }

    /**
   * D1-3查询职务级别列表
   */
    @PostMapping("queryPositionGradeList")
    public OkrResult<QueryPositionGradeListRespDto> queryPositionGradeList(@RequestBody @Validated QueryPositionGradeListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryPositionGradeListRespDto retData = postTypeService.queryPositionGradeList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-3新增职务级别
   */
    @PostMapping("addPositionGrade")
    public OkrResult<AddPositionGradeRespDto> addPositionGrade(@RequestBody @Validated AddPositionGradeReqDto reqDTO){
    return OkrResult.success(postTypeService.addPositionGrade(reqDTO));
    }

    /**
   * D1-3修改等级范围
   */
    @PostMapping("updateGradeScope")
    public OkrResult<UpdateGradeScopeRespDto> updateGradeScope(@RequestBody @Validated UpdateGradeScopeReqDto reqDTO){
    return OkrResult.success(postTypeService.updateGradeScope(reqDTO));
    }

    /**
   * D1-3查询岗位体系
   */
    @PostMapping("queryStationSystemList")
    public OkrResult<QueryStationSystemListRespDto> queryStationSystemList(@RequestBody @Validated QueryStationSystemListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryStationSystemListRespDto retData = postTypeService.queryStationSystemList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-3查询等级范围列表（边界）
   */
    @PostMapping("queryGradeScopeListBorder")
    public OkrResult<QueryGradeScopeListBorderRespDto> queryGradeScopeListBorder(@RequestBody @Validated QueryGradeScopeListBorderReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryGradeScopeListBorderRespDto retData = postTypeService.queryGradeScopeListBorder(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-3查询职务级别列表（边界）
   */
    @PostMapping("queryPositionGradeListBorder")
    public OkrResult<QueryPositionGradeListBorderRespDto> queryPositionGradeListBorder(@RequestBody @Validated QueryPositionGradeListBorderReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryPositionGradeListBorderRespDto retData = postTypeService.queryPositionGradeListBorder(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-3查询等级范围列表
   */
    @PostMapping("queryGradeScopeList")
    public OkrResult<QueryGradeScopeListRespDto> queryGradeScopeList(@RequestBody @Validated QueryGradeScopeListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryGradeScopeListRespDto retData = postTypeService.queryGradeScopeList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-3删除岗位类型
   */
    @PostMapping("deleteStationType")
    public OkrResult<DeleteStationTypeRespDto> deleteStationType(@RequestBody @Validated DeleteStationTypeReqDto reqDTO){
    return OkrResult.success(postTypeService.deleteStationType(reqDTO));
    }

    /**
   * D1-3新增岗位类型
   */
    @PostMapping("addStationType")
    public OkrResult<AddStationTypeRespDto> addStationType(@RequestBody @Validated AddStationTypeReqDto reqDTO){
    return OkrResult.success(postTypeService.addStationType(reqDTO));
    }

    /**
   * D1-3修改岗位类型
   */
    @PostMapping("updateStationType")
    public OkrResult<UpdateStationTypeRespDto> updateStationType(@RequestBody @Validated UpdateStationTypeReqDto reqDTO){
    return OkrResult.success(postTypeService.updateStationType(reqDTO));
    }

    /**
   * D1-3查询岗位类型详情
   */
    @PostMapping("queryStationTypeDetail")
    public OkrResult<QueryStationTypeDetailRespDto> queryStationTypeDetail(@RequestBody @Validated QueryStationTypeDetailReqDto reqDTO){
    return OkrResult.success(postTypeService.queryStationTypeDetail(reqDTO));
    }

    /**
   * D1-3查询岗位类型列表（边界）
   */
    @PostMapping("queryStationTypeListBorder")
    public OkrResult<QueryStationTypeListBorderRespDto> queryStationTypeListBorder(@RequestBody @Validated QueryStationTypeListBorderReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryStationTypeListBorderRespDto retData = postTypeService.queryStationTypeListBorder(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-3查询岗位类型列表
   */
    @PostMapping("queryStationTypeList")
    public OkrResult<QueryStationTypeListRespDto> queryStationTypeList(@RequestBody @Validated QueryStationTypeListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryStationTypeListRespDto retData = postTypeService.queryStationTypeList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-3取消修订岗位类型
   */
    @PostMapping("undoReviseStationType")
    public OkrResult<UndoReviseStationTypeRespDto> undoReviseStationType(@RequestBody @Validated UndoReviseStationTypeReqDto reqDTO){
    return OkrResult.success(postTypeService.undoReviseStationType(reqDTO));
    }

    /**
   * D1-3修改职务级别
   */
    @PostMapping("updatePositionGrade")
    public OkrResult<UpdatePositionGradeRespDto> updatePositionGrade(@RequestBody @Validated UpdatePositionGradeReqDto reqDTO){
    return OkrResult.success(postTypeService.updatePositionGrade(reqDTO));
    }

    /**
   * D1-3查询岗位等级列表
   */
    @PostMapping("queryPostGradesList")
    public OkrResult<QueryPostGradesListRespDto> queryPostGradesList(@RequestBody @Validated QueryPostGradesListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryPostGradesListRespDto retData = postTypeService.queryPostGradesList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-3存档岗位类型
   */
    @PostMapping("archiveStationType")
    public OkrResult<ArchiveStationTypeRespDto> archiveStationType(@RequestBody @Validated ArchiveStationTypeReqDto reqDTO){
    return OkrResult.success(postTypeService.archiveStationType(reqDTO));
    }

    /**
   * D1-3批量删除等级范围（处理步骤）
   */
    @PostMapping("batchDeleteGradeScopeAndDeleteStep")
    public OkrResult<BatchDeleteGradeScopeAndDeleteStepRespDto> batchDeleteGradeScopeAndDeleteStep(@RequestBody @Validated BatchDeleteGradeScopeAndDeleteStepReqDto reqDTO){
    return OkrResult.success(postTypeService.batchDeleteGradeScopeAndDeleteStep(reqDTO));
    }

    /**
   * D1-3批量修改职务级别等级范围
   */
    @PostMapping("batchUpdatePositionGrade")
    public OkrResult<BatchUpdatePositionGradeRespDto> batchUpdatePositionGrade(@RequestBody @Validated BatchUpdatePositionGradeReqDto reqDTO){
    return OkrResult.success(postTypeService.batchUpdatePositionGrade(reqDTO));
    }
}
